home *** CD-ROM | disk | FTP | other *** search
- From: jason@cygnus.com (Jason Merrill)
- Message-ID: <u9vilu8zvz.fsf@yorick.cygnus.com>
- X-Original-Date: 29 Jan 1996 13:17:04 -0800
- Path: in2.uu.net!bounce-back
- Date: 30 Jan 96 04:52:15 GMT
- Approved: fjh@cs.mu.oz.au
- Return-Path: <daemon@meeker.UCAR.EDU>
- Newsgroups: comp.std.c++
- Subject: Re: Observations on templates
- Organization: Cygnus Support, Mountain View, CA
- References: <ACVI83na99@qsar.chem.msu.su>
- In-Reply-To: "Eugene Radchenko"'s message of 29 Jan 96 10:38:37 GMT
- X-Newsreader: Gnus v5.0
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMQ2kHeEDnX0m9pzZAQHbawF/VzoUaPmjOk46E1MvJcY0cNlvDbjoEj8g
- kNoSdG4TAAsbNQtfZ+4rIxQoBsYO0aor
- =Osqu
-
- >>>>> Eugene Radchenko <eugene@qsar.chem.msu.su> writes:
-
- > 1) Clause [temp.res] verse 1 requires that all types dependent on the
- > template parameter must be qualified by 'typename' keyword - supposedly to
- > allow checking the template syntax. But it does not help anything as _each_
- > instance will have to be checked anyway:
-
- Requiring 'typename' allows syntactic analysis and some name binding
- to be done at the point of definition of the template. Older
- implementations do all name binding at the point of instantiation,
- which was thought to be confusing.
-
- Each instance will indeed have to be checked, but only for semantic
- correctness, not syntactic.
-
- > 2) Clause [temp.dep] verse 5 states that base class scope names hide the
- > template parameter:
-
- This is for orthogonality. Think of the template header as creating a
- special scope around the class; name lookups in class scope look in the
- current class, then in base classes, then in the surrounding scope.
-
- Note that template parameters used as base types are not affected by this
- rule, since name binding is done on the template definition, before the
- base is known.
-
- > 3) Clause [temp.arg.explicit] verses 2-3 requires that for explicit arg in
- > member template to be present it must be qualified by 'template' keyword,
- > e.g.
- > X *p; p->template alloc<200>();
- > But to use operator -> we need X class definition anyway - so we know that
- > alloc() is a template.
-
- It is needed in some situations where we do not have the X class definition
- -- in template definitions, like with typename.
-
- Jason
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-